package HLLib.base;

import java.util.Enumeration;
import java.util.Hashtable;

import HLCode.HLClass;
import HLCode.HLClassManager;
import HLCode.HLClassManager_H;
import HLCode.HLLibObject;
import HLCode.HLObject;

public class HLDictionary extends HLLibObject {
    public HLClass GetClass(HLClassManager classManager) {
        return classManager.GetLibClass(HLClassManager_H.CLASS_GROUP_TYPE_LIB_BASE, HLClassManager_H.LIB_CLASS_BASE_Dictionary);
    }

    Hashtable hashtable = new Hashtable();

    public int Count() {
        return hashtable.size();
    }

    public HLObject GetItem(HLString key) {
        return (HLObject) hashtable.get(key.string);
    }

    public Object GetItem1(String key) {
        return hashtable.get(key);
    }

    public void Put(HLString key, HLObject value) {
        hashtable.put(key.string, value);
    }

    public void Put1(String key, Object value) {
        hashtable.put(key, value);
    }

    public void Clear() {
        hashtable.clear();
    }

    public boolean ContainsKey(HLString key) {
        return hashtable.containsKey(key.string);
    }

    public boolean ContainsKey1(String key) {
        return hashtable.containsKey(key);
    }

    public boolean ContainsValue(HLObject value) {
        return hashtable.contains(value);
    }

    public boolean ContainsValue1(Object value) {
        return hashtable.contains(value);
    }

    public void Remove(HLString key) {
        hashtable.remove(key.string);
    }

    public void Remove1(String key) {
        hashtable.remove(key);
    }

    public HLList GetKeys() {
        HLList result = new HLList();
        Enumeration keys = this.hashtable.keys();
        while (keys.hasMoreElements()) {
            String tmp = (String) keys.nextElement();
            result.Add(new HLString(tmp));
        }
        return result;
    }

    public HLList GetValues() {
        HLList result = new HLList();
        Enumeration elements = this.hashtable.elements();
        while (elements.hasMoreElements()) {
            HLObject tmp = (HLObject) elements.nextElement();
            result.Add(tmp);
        }
        return result;
    }
}
